“Code coverage” or “test coverage” is a measure of the amount of code in a software program or module that is executed when the software is tested. The higher the code coverage, the greater the likelihood that any errors in the software program or module will be detected during the test. Thus, it is important for software developers to be able to determine code coverage as it provides a metric as to whether the software has been sufficiently tested.
Known methods exist for determining the code coverage. Such known methods generally require “instrumentation” of the code before it is subject to testing. Instrumentation refers to a process whereby probes are added to the software to be tested. The probes are code, which are added to either the source code or the compiled code, to call another program that measures code coverage.
Methods for determining code coverage that require instrumentation of the source code have disadvantages. For example, such methods are dependent on the particular programming language used to generate the source code. Additionally, instrumentation of the source code is cumbersome and is itself a process that is prone to generating errors in the code. Further, if the source code is unavailable, determination of the code coverage is generally not possible using such methods.
Moreover, some methods for determining code coverage collect statistics on the entire software module under test including portions of the module, such as standard C++libraries, that are not of interest. Some methods also execute the code coverage method on portions of the code of interest even if coverage of those portions has previously been determined. These code coverage methods unnecessarily impact the performance of the software under test as there is inherent resource overhead in measuring code coverage.